package com.atlin.project.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author atlin
 * @description 读取项目相关配置
 * @createDate 2024/9/11 22:25
 */
@Component
@ConfigurationProperties(prefix = "atlin")
public class AtLinConfig {

    /**
     * 名称
     */
    private String name;

    /**
     * 版本
     */
    private String version;

    /**
     * 文件上传路径
     */
    private static String filePath;

    /**
     * 获取地址开关
     */
    private static Boolean addressEnable;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        AtLinConfig.filePath = filePath;
    }

    public Boolean getAddressEnable() {
        return addressEnable;
    }

    public void setAddressEnable(Boolean addressEnable) {
        AtLinConfig.addressEnable = addressEnable;
    }

    public static boolean isAddressEnable() {
        return addressEnable;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath() {
        return filePath + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath() {
        return filePath + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath() {
        return filePath + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath() {
        return filePath + "/upload";
    }

}
